<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ include file="common.inc" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
<link href="./css/style.css" rel="stylesheet" type="text/css">
<link rel="stylesheet" href="./css/fusionCharts.css" type="text/css" />
<script language="javascript" src="./js/FusionCharts.js"></script>
<script language="javascript" src="./js/sale-monitor.js"></script>
<script type="text/javascript" language="javascript">
<!--
	//start 定义一个javascript对象，用于存储销售排名数据
	function saleTop(salePerson,finishedTarget){
		this.salePerson = salePerson;//销售负责人
		this.finishedTarget = finishedTarget;//已完成指标
	}
	var saleTops = new Array();
	<c:forEach var="saleTop" items="${buinessTarget.saleTop5s}">
		var finishedTarget = 0;
		<c:choose>
			<c:when test='${buinessTarget.type == "isContract"}'>finishedTarget = "${saleTop.updatePersonId}";</c:when>
			<c:when test='${buinessTarget.type == "isBackCost"}'>finishedTarget = "${saleTop.updatePersonId}";</c:when>
			<c:when test='${buinessTarget.type == "isGrossProfit"}'>finishedTarget = "${saleTop.updatePersonId}";</c:when>
			<c:when test='${buinessTarget.type == "isHand"}'>finishedTarget = "${saleTop.updatePersonId}";</c:when>
		</c:choose>
		saleTops.push(new saleTop("${saleTop.userName}",finishedTarget));
	</c:forEach>
	//end


	function viewNewsNotice(id){
		window.location.href = "./newsNotice.do?action=viewNewsNotice&id="+id;
		window.location.target = "main";
	}
	
	function viewEmployeeBBS(id){
		window.location.href = "./employeeBBS.do?action=viewEmployeeBBS&id="+id;
		window.location.target = "main";
	}
	
	function scheduleWaringInfo(){
		if("<c:out value='${isViewScheduleRemind}'/>" == 1){
			window.location.href = "./scheduleRemind.do";
		}else{
			window.location.href = "#";
		}
		window.location.target = "main";
	}
	
	function auditWaringInfo(){
		if("<c:out value='${isViewAuditRemind}'/>" == 1){
			window.location.href = "./auditRemind.do";
		}else{
			window.location.href = "#";
		}
		window.location.target = "main";
	}
	
	function systemWaringInfo(){
		if("<c:out value='${isViewSystemRemind}'/>" == 1){
			window.location.href = "./systemRemind.do";
		}else{
			window.location.href = "#";
		}
		window.location.target = "main";
	}
-->
</script>
</head>
<body class="main_body">
<table style="text-align: center;" class="table" cellpadding="0" cellspacing="0" border="0" width="100%" height="100%">
	<tr><td height="5"></td></tr>
	<tr>
		<td align="left">
			<table class="main_title" cellpadding="0" cellspacing="0">
				<tr>
					<td class="title" colspan="3">&nbsp;&nbsp;我的主页</td>
				</tr>
				<tr>
					<td class="title2">&nbsp;&nbsp;&nbsp;<fmt:formatDate value="<%=new java.util.Date() %>" pattern="EEEE yyyy年MM月dd日"/></td>
					<td class="title2" align="right">上次登录：<fmt:formatDate value="${lastLogin}" pattern="MM月dd日 HH:mm"/>&nbsp;&nbsp;</td>
					<td width="20"></td>
				</tr>
			</table>
		</td>
	</tr>
	<tr><td height="4"></td></tr>
	<tr>
		<!-- 显示指标等 -->
		<td>
			<table cellpadding="0" cellspacing="0" border="0" width="100%" height="30">
				<tr>
					<td width="100" style="color: #ffffff;background: url('./images/midlineright.bmp') no-repeat;">
						<c:choose>
							<c:when test="${buinessTarget.assignPeriod == '1'}">
								本月指标
								<c:set var="title" value="本月指标"/>
							</c:when>
							<c:when test="${buinessTarget.assignPeriod == '2'}">
								本季度指标
								<c:set var="title" value="本季度指标"/>
							</c:when>
							<c:when test="${buinessTarget.assignPeriod == '3'}">
								本年度指标
								<c:set var="title" value="本年度指标"/>
							</c:when>
							<c:otherwise></c:otherwise>
						</c:choose>
					</td>
					<td background="./images/midlinemid.bmp">
						<table cellpadding="0" cellspacing="0" border="0" width="600" height="30">
							<tr>
								<td>
									<marquee onmouseover="this.stop()" onmouseout="this.start()" direction="left" scrolldelay="160">
									业绩指标&nbsp;&nbsp;&nbsp;&nbsp;-&nbsp;&nbsp;&nbsp;&nbsp;<font color="red">￥ <fmt:formatNumber value="${buinessTarget.periodTarget}" pattern="###,###,###,###"/></font>&nbsp;&nbsp;&nbsp;&nbsp;
									-&nbsp;&nbsp;&nbsp;&nbsp;完成比率&nbsp;&nbsp;&nbsp;&nbsp;-&nbsp;&nbsp;&nbsp;&nbsp;<fmt:formatNumber value="${buinessTarget.finishedRate}" pattern="###,###,###,###.##"/>%&nbsp;&nbsp;&nbsp;&nbsp;
									-&nbsp;&nbsp;&nbsp;&nbsp;签约金额&nbsp;&nbsp;&nbsp;&nbsp;-&nbsp;&nbsp;&nbsp;&nbsp;￥ <fmt:formatNumber value="${buinessTarget.contractCost}" pattern="###,###,###,###"/>&nbsp;&nbsp;&nbsp;&nbsp;
									-&nbsp;&nbsp;&nbsp;&nbsp;申请费用&nbsp;&nbsp;&nbsp;&nbsp;-&nbsp;&nbsp;&nbsp;&nbsp;￥ <fmt:formatNumber value="${buinessTarget.saleCost}" pattern="###,###,###,###"/>
									</marquee>
								</td>
							</tr>
						</table>
					</td>
					<td width="50" style="background: url('./images/midlineleft.bmp') no-repeat;"></td>
				</tr>
			</table>
		</td>
	</tr>
	<tr><td height="5"></td></tr>
	<tr>
		<!-- 显示销售排名图 -->
		<td valign="top">
			<table cellpadding="0" cellspacing="0" border="0" width="100%" height="140">
				<tr>
					<td width="49%">
						<table cellpadding="0" cellspacing="0" border="0" height="100%">
							<tr>
								<td>
									<div id="chartdiv141" align="left">销售排名前三</div>
									<script type="text/javascript">
										saleSortTop5Image("chartdiv141",saleTops);
									</script>
								</td>
							</tr>
						</table>
					</td>
					<td width="49%" valign="top">
						<table cellpadding="0" cellspacing="0" border="0" height="100%">
							<tr>
								<td>
									<table cellpadding="0" cellspacing="0" border="0" height="100%">
										<tr>
											<td>
												<div id="chartdiv11" align="left">周期预测图</div>
												<script type="text/javascript">
													saleImage2("chartdiv11",${buinessTarget.targetSign1},${buinessTarget.targetSign2},${buinessTarget.targetSign3},${buinessTarget.predictCost});
												</script>
											</td>
										</tr>
										<tr><td style="color: #60634e;font-weight: bold;">业绩预测</td></tr>
									</table>
								</td>
								<td width="20"></td>
								<td valign="top">
									<table cellpadding="0" cellspacing="0" border="0" height="100%">
										<tr>
											<td>
												<div id="chartdiv12" align="left">周期完成图</div>
												<script type="text/javascript">
													saleImage2("chartdiv12",${buinessTarget.targetSign1},${buinessTarget.targetSign2},${buinessTarget.targetSign3},${buinessTarget.finishedTarget});
												</script>
											</td>
										</tr>
										<tr><td style="color: #60634e;font-weight: bold;">业绩达成</td></tr>
									</table>
								</td>
							</tr>
						</table>
					</td>
				</tr>
			</table>
		</td>
	</tr>
	<tr><td></td></tr>
	<tr>
		<td>
			<table cellpadding="0" cellspacing="0" border="0" width="100%" height="100%">
				<tr>
					<td align="left" valign="top" width="51%">
						<table class="" cellpadding="0" cellspacing="0" border="0" width="100%">
							<tr><td class="line2"></td></tr>
							<tr>
								<td class="page_title2">&nbsp;&nbsp;新闻公告</td>
							</tr>
							<tr>
								<td>
									<table class="news_table" cellpadding="0" cellspacing="0">
										<c:choose>
										<c:when test="${not empty newsNotices}">
										<c:forEach var="newsNotice" items="${newsNotices}">
										<tr>
											<td><li></li>
												<a href="javascript:viewNewsNotice('${newsNotice.id}');" title="${newsNotice.subject}" target="main" hidefocus="true">
												<c:choose>
													<c:when test="${fn:length(newsNotice.subject) > 10}">${fn:substring(newsNotice.subject,0,10)}......</c:when>
													<c:otherwise>${newsNotice.subject}</c:otherwise>
												</c:choose> 
												</a>
												[<fmt:formatDate value="${newsNotice.sendDate}" pattern="yy/MM/dd"/>]
											</td>
										</tr>
										</c:forEach>
										</c:when>
										<c:otherwise>
											<tr><td>暂无信息</td></tr>
										</c:otherwise>
										</c:choose>
									</table>
								</td>
							</tr>
						</table>
					</td>
					<td width="2"></td>
					<td align="left" valign="top" width="">
						<table class="" cellpadding="0" cellspacing="0" border="0" width="100%">
							<tr><td class="line2"></td></tr>
							<tr>
								<td class="page_title2">&nbsp;&nbsp;内部论坛</td>
							</tr>
							<tr>
								<td>
									<table class="news_table" cellpadding="0" cellspacing="0">
										<c:choose>
										<c:when test="${not empty employeeBBSs}">
										<c:forEach var="employeeBBS" items="${employeeBBSs}">
										<tr>
											<td><li></li>
												<a href="javascript:viewEmployeeBBS('${employeeBBS.id}');" title="${employeeBBS.subject}" target="main" hidefocus="true">
												<c:choose>
													<c:when test="${fn:length(employeeBBS.subject) > 10}">${fn:substring(employeeBBS.subject,0,10)}......</c:when>
													<c:otherwise>${employeeBBS.subject}</c:otherwise>
												</c:choose> 
												</a>
												[<fmt:formatDate value="${employeeBBS.sendDate}" pattern="yy/MM/dd"/>]
											</td>
										</tr>
										</c:forEach>
										</c:when>
										<c:otherwise>
											<tr><td>暂无信息</td></tr>
										</c:otherwise>
										</c:choose>
									</table>
								</td>
							</tr>
						</table>
					</td>
				</tr>
			</table>
		</td>
	</tr>
	<c:if test="${warningWay['way1'].status == 1 && warningWay['isWay'] == 'true'}">
	<tr><td height="30"></td></tr>
	<tr>
		<td align="left" valign="top">
			<table class="" cellpadding="0" cellspacing="0" border="0" width="100%">
				<tr><td class="line2"></td></tr>
				<tr>
					<td class="page_title2">&nbsp;&nbsp;我的日程</td>
				</tr>
				<tr>
					<td valign="top">
						<table cellpadding="0" cellspacing="0" border="0" width="100%" height="100%">
							<tr>
								<td width="5"></td>
								<td valign="top" width="49%">
									<table style="margin-left: 5px;" cellpadding="0" cellspacing="0" border="0" width="100%" height="100%">
										<tr>
											<td height="5"></td>
										</tr>
										<tr>
											<td style="color: #737474;height: 20px;">上午</td>
										</tr>
										<tr><td class="line"></td></tr>
										<tr>
											<td height="5"></td>
										</tr>
										<%int i = 0; %>
										<c:set var="currentDate"><fmt:formatDate value='<%=new java.util.Date()%>' pattern='yyyy-MM-dd'/></c:set>
										<c:forEach var="warningInfo" items="${warningInfoBySchedules}">
										<c:set var="warningDate"><fmt:formatDate value='${warningInfo.warningDate}' pattern='yyyy-MM-dd'/></c:set>
										<c:if test="${warningDate == currentDate && warningInfo.agingDay == 1}">
										<tr>
											<td height="22">
												<c:choose>
													<c:when test="${fn:length(warningInfo.foreignName) > 10}">${fn:substring(warningInfo.foreignName,0,10)}......</c:when>
													<c:otherwise>${warningInfo.foreignName}</c:otherwise>
												</c:choose>
											</td>
										</tr>
										<% i++; %>
											</c:if>
										</c:forEach>
										<%if(i <= 0){%>
										<tr>
											<td height="22">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;暂无安排</td>
										</tr>
										<%} %>
									</table>
								</td>
								<td width="45"></td>
								<td valign="top" width="49%">
									<table style="margin-left: 5px;" cellpadding="0" cellspacing="0" border="0" width="100%" height="100%">
										<tr>
											<td height="5"></td>
										</tr>
										<tr>
											<td style="color: #737474;height: 20px;">下午</td>
										</tr>
										<tr><td class="line"></td></tr>
										<tr>
											<td height="5"></td>
										</tr>
										<%int j = 0; %>
										<c:set var="currentDate"><fmt:formatDate value='<%=new java.util.Date()%>' pattern='yyyy-MM-dd'/></c:set>
										<c:forEach var="warningInfo" items="${warningInfoBySchedules}">
										<c:set var="warningDate"><fmt:formatDate value='${warningInfo.warningDate}' pattern='yyyy-MM-dd'/></c:set>
										<c:if test="${warningDate == currentDate && warningInfo.agingDay == 2}">
										<tr>
											<td height="22">
												<c:choose>
													<c:when test="${fn:length(warningInfo.foreignName) > 10}">${fn:substring(warningInfo.foreignName,0,10)}......</c:when>
													<c:otherwise>${warningInfo.foreignName}</c:otherwise>
												</c:choose>
											</td>
										</tr>
										<% j++; %>
											</c:if>
										</c:forEach>
										<%if(j <= 0){%>
										<tr>
											<td height="22">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;暂无安排</td>
										</tr>
										<%} %>
									</table>
								</td>
							</tr>
						</table>
					</td>
					<td></td>
				</tr>
			</table>
		</td>
	</tr>
	<tr><td height="30"></td></tr>
	<tr>
		<td align="left" valign="top">
			<table class="" cellpadding="0" cellspacing="0" border="0" width="100%">
				<tr>
					<td colspan="2" style="height: 3px;background-color: #83BDD7;"></td>
				</tr>
				<tr>
					<td colspan="2" class="page_title2">&nbsp;&nbsp;预警中心</td>
				</tr>
				<tr>
					<td height="5"></td>
					<td>
						<table class="table_view" cellpadding="0" cellspacing="0" style="width: 60%;">
							<tr>
								<td class="title2">预警日期</td>
								<td class="title2">来源</td>
								<td class="title2">主题</td>
								<td class="title2">客户</td>
							</tr>
							<c:forEach var="warningInfo" items="${warningInfoByAudits}">
							<c:if test="${empty warningInfo.processDate}">
							<tr>
								<td style="color: red;"><fmt:formatDate value="${warningInfo.warningDate}" pattern="yyyy/MM/dd"/></td>
								<td>
									<c:choose>
										<c:when test="${warningInfo.warningSource == '1'}">合同</c:when>
										<c:when test="${warningInfo.warningSource == '2'}">费用</c:when>
									</c:choose>
								</td>
								<td>
									<c:choose>
										<c:when test="${warningInfo.warningSource == '1'}">待审合同：编号${warningInfo.foreignCode}&nbsp;&nbsp;${warningInfo.foreignName}</c:when>
										<c:when test="${warningInfo.warningSource == '2'}">待审费用：申请单&nbsp;&nbsp;${warningInfo.foreignCode}</c:when>
									</c:choose>
								</td>
								<td>
									<c:choose>
										<c:when test="${fn:length(warningInfo.foreignName) > 10}">${fn:substring(warningInfo.foreignName,0,10)}......</c:when>
										<c:otherwise>${warningInfo.foreignName}</c:otherwise>
									</c:choose>
								</td>
							</tr>
							</c:if>
							</c:forEach>
							<c:forEach var="warningInfo" items="${warningInfoBySystems}">
							<tr>
								<td style="color: red;"><fmt:formatDate value="${warningInfo.warningDate}" pattern="yyyy/MM/dd"/></td>
								<td>
									<c:choose>
										<c:when test="${warningInfo.warningSource == '3'}">公海</c:when>
										<c:when test="${warningInfo.warningSource == '5'}">其他</c:when>
									</c:choose>
								</td>
								<td>
									<c:choose>
										<c:when test="${warningInfo.warningCode == 'openSeaRemind'}">
											<c:choose>
												<c:when test="${warningInfo.isAging == '1'}">${warningInfo.foreignName}&nbsp;&nbsp;${warningInfo.agingDay}天超期</c:when>
												<c:when test="${warningInfo.isAging == '2'}">${warningInfo.foreignName}&nbsp;&nbsp;已被转移</c:when>
											</c:choose>
										</c:when>
										<c:when test="${warningInfo.warningCode == 'contractRemind'}">
											到期合同：编号${warningInfo.foreignCode}&nbsp;&nbsp;${warningInfo.foreignName}
										</c:when>
									</c:choose>
								</td>
								<td>
									<c:choose>
										<c:when test="${fn:length(warningInfo.foreignName) > 10}">${fn:substring(warningInfo.foreignName,0,10)}......</c:when>
										<c:otherwise>${warningInfo.foreignName}</c:otherwise>
									</c:choose>
								</td>
							</tr>
							</c:forEach>
						</table>
					</td>
				</tr>
			</table>
		</td>
	</tr>
	</c:if>
	<tr><td></td></tr>
</table>
</body>
</html>